package net.exoweb.animate.graphics
{
    import flash.display.*;
    import flash.geom.*;

    import net.exoweb.animate.common.Maths;
    import net.exoweb.animate.graphics.GShape;

    public class GBeam extends GShape
    {
        protected var _w:Number;
        protected var _h:Number;

        public function GBeam(w:Number, h:Number, bm:String="overlay")
        {
            super(color, bm);
            _w = w;
            _h = Math.sqrt(w*w + h*h);
        }

        override public function display():void
        {
            var matr:Matrix = new Matrix();
            matr.createGradientBox(_w, _h);
            graphics.clear();
            graphics.beginGradientFill(GradientType.LINEAR,
                                       [0xFFFFFF, 0],
                                       [1, 0], [0, 127],
                                       matr, SpreadMethod.REFLECT);
            graphics.drawRect(-_w/2, -_h/2, _w, _h);
            graphics.endFill();
        }
    }
}
